﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PwjCy.Lite.Persistence
{
    /// <summary>
    /// 存储别名告知者（告诉程序，对应的表在哪个库中）
    /// </summary>
    public interface IStorageAliasTeller
    {
        StorageAliasTellerType StorageAliasTellerType { get; }
        /// <summary>
        /// 获取上下文名称
        /// </summary>
        /// <param name="storageAlias">存储别名（包含数据库，数据表特定的数据格式信息）</param>
        /// <returns></returns>
        string GetContextName(string storageAlias);
        /// <summary>
        /// 获取分库散射的维度
        /// </summary>
        /// <param name="dimension">分库维度</param>
        /// <param name="cls">表分类对象</param>
        /// <returns></returns>
        string GetDimensionStorageAlias(int dimension, object cls);
        string[] GetDimensionStorageAliases(int dimension);
        string[] GetMaxIntIdPrimaryStorageAliases();
        string[] GetPrimaryLoadStorageAliases(object id);
        string GetPrimarySaveStorageAlias(object id);
        string GetTableName(string storageAlias);
        bool IsMapped(string storageAlias);
    }
    /// <summary>
    /// 通知者类型
    /// </summary>
    public enum StorageAliasTellerType
    {
        Single = 1,//单库
        Mulitiple = 2,//多库
    }
}
